﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="quan_tri_thuoc_tinh.ascx.cs" Inherits="quan_tri_thuoc_tinh" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<telerik:RadAjaxManager OnAjaxRequest="Ajax_Request" ID="RadAjaxManager1" runat="server" 
    DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdProperties" />
                <telerik:AjaxUpdatedControl ControlID="cboPropertiesTypeName" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="cboPropertiesTypeName">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdProperties" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="grdProperties">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdProperties" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>

<telerik:RadWindowManager OnClientClose="Window_Close" ID="RadWindowManager1" runat="server" >
    <Windows>
        <telerik:RadWindow VisibleStatusbar="false" Width="800px" Height="600px" runat="server" ID="windows1"></telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function Window_Close() {
            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }
    </script>
</telerik:RadCodeBlock>

<asp:Label runat="server" ID="lblMessage"></asp:Label>

<fieldset>
    <legend>Danh Sách Thuộc Tính</legend>
    Chọn Nhóm Thuộc Tính: 
    <asp:DropDownList AutoPostBack="true" Skin="WebBlue" GridLines="Horizontal"  DataValueField="PropertyTypeName" DataTextField="PropertyTypeName" ID="cboPropertiesTypeName" runat="server" 
        OnSelectedIndexChanged="cboPropertiesTypeName_SelectedIndexChanged">
    </asp:DropDownList>
    
    <a class="link-add-new" href="/Admin/Form/Properties_Add.aspx" ><img src="/Image/add2.png" alt="Thêm mới thuộc tính" title="Thêm mới thuộc tính" />Thêm Mới</a>
    
    <telerik:RadGrid AllowFilteringByColumn="True" AutoGenerateColumns="false" ID="grdProperties" Skin="WebBlue" runat="server">
        <MasterTableView>
            <Columns>
                <telerik:GridTemplateColumn HeaderText="Tên Thuộc Tính" DataField="PropertyName">
                    <ItemTemplate>
                        <a href="#" onclick="openRadWindow('/Admin/Form/Properties_Add.aspx?id=<%#DataBinder.Eval(Container.DataItem,"PropertyID")%>','windows1'); return false;">
                            <%# Eval("PropertyName")%>
                        </a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            
                <telerik:GridBoundColumn DataField="PropertyName" UniqueName="PropertyName" HeaderText="Tên Nhóm" AllowFiltering="true">
                </telerik:GridBoundColumn>
                
                <telerik:GridBoundColumn DataField="PropertyValue" UniqueName="PropertyValue" HeaderText="Giá Trị" AllowFiltering="true">
                </telerik:GridBoundColumn>
                
                <telerik:GridCheckBoxColumn DataField="IsEdit" UniqueName="IsEdit" HeaderText="Quyền Sửa" AllowFiltering="true">
                </telerik:GridCheckBoxColumn>
                
                <telerik:GridCheckBoxColumn DataField="IsActive" UniqueName="IsActive" HeaderText="Hoạt Động" AllowFiltering="true">
                </telerik:GridCheckBoxColumn>
                
                <telerik:GridTemplateColumn HeaderText="Xóa">
                    <ItemTemplate>
                        <asp:LinkButton CausesValidation="false" OnClientClick="return ConfirmDelete()" OnClick="Properties_Delete" CommandArgument='<%# Eval("PropertyID") %>' ID="LinkButton2" runat="server">Xóa</asp:LinkButton>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        
    </telerik:RadGrid>
</fieldset>